<%@ include file="/common/taglibs.jsp"%>
<title><fmt:message key="query.title"/></title>
<content tag="heading"><fmt:message key="query.heading"/></content>

<spring:bind path="query.*">
    <c:if test="${not empty status.errorMessages}">
    <div class="error">    
        <c:forEach var="error" items="${status.errorMessages}">
            <img src="<c:url value="/images/iconWarning.gif"/>"
                alt="<fmt:message key="icon.warning"/>" class="icon" />
            <c:out value="${error}" escapeXml="false"/><br />
        </c:forEach>
    </div>
    </c:if>
</spring:bind>

<form:form commandName="query" method="post" 
           action="query.html"  id="queryForm">
	       
	   <p>You can get agendas based on Role and/or User. </p>
	   <p>If you provide both Role and User, the resulting agenda list will 
	         be an intersection of the list queried by each one.</p>
	   <table id="query">
	       <tr>
		   <td>
		       <label><fmt:message key="query.tmrolename"/>:</label>
		   </td>
		   <td>
		       <form:errors path="tmrolename" cssClass="fieldError"/>
		       <select class="medium" name="tmrolename">
			    <option value=" "></option>
			    <c:forEach var="tmroleItem" items="${availableTMRoles}" varStatus="status">
				<option value='<c:out value="${tmroleItem.name}"/>'>
				    <c:out value="${tmroleItem.name}" escapeXml="false" />
				</option>
			    </c:forEach>
			</select>
		   </td>
	       </tr>
	       <tr>
		   <td>
		       <label><fmt:message key="query.username"/>:</label>
		   </td>
		   <td>
		       <form:errors path="username" cssClass="fieldError"/>
		       <select class="medium" name="username">
			    <option value=" "></option>
			    <c:forEach var="userItem" items="${availableUsers}" varStatus="status">
				<option value='<c:out value="${userItem.username}"/>'>
				    <c:out value="${userItem.username}" escapeXml="false" />
				</option>
			    </c:forEach>
			</select>
		   </td>
	       </tr>
	       <tr>
		    <td colspan="2">
			<input type="submit" class="button" name="query"  onclick="bCancel=false" value="<fmt:message key="button.query"/>" />
			<input type="submit" class="button" name="cancel" onclick="bCancel=true" value="<fmt:message key="button.cancel"/>" />
		    </td>
		</tr>
	   </table>
</form:form>